<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:wh="http://java.sun.com/jsf/composite/wh"
	xmlns:p="http://primefaces.org/ui">
<h:body>
	<ui:composition template="template/template.xhtml">
		<ui:define name="content">
				<p:panel id="adminmain">
					
						<h1>Startsite for the administrator</h1>
						
						<p:panel header="Information" toggleable="true" collapsed="true">
							<h:form id="form1" styleClass="horizontal_full">
							    <p:commandLink value="Download Admin Manual" ajax="false"  icon="ui-icon-arrowthick-1-s">
							        <p:fileDownload value="#{userMBean.getAdminManualFile()}" ajax="true" />
							    </p:commandLink>
								
								<p>Logged in as user: #{userMBean.user.nickname} with mail: #{userMBean.user.email}</p>
								<p>
									Welcome to the Business Strategy Game. At the right top corner you can find the different menus where you can get an overview of the games/product/supplier settings, statistics to the games or other settings. 
								</p>
								<p>
									Now there is a little overview of some important links which you can all find at the right top corner menu.	
								</p>
								<p>
									Main Site: navigates you back to this site. You can see your login information and send Messages to all users off a concrete game.
								</p>
								<p>
									Game Management: navigates you to a page where you can configure and create a game with different users, rounds, agent types and agents. You also need this page to simulate different rounds during the game.
								</p>
								<p>
									Product Management: navigates you to a page where you can configure and create/manage different products for all games. 
								</p>
								<p>
									Supplier Management: navigates you to a page where you can configure and create/manage different suppliers for all games. 
								</p>
								<p>
									Game Statistics: navigates you to a page where you can see different statistics as tables and graphics for the games.
								</p>
								<p>
									Own Settings: navigates you to a page where you can configure your own user name and password.
								</p>
								<p>
									Game Settings: navigates you to a page where you can configure the global variables that are used for the simulation.
								</p>
								<p>
									Log Out: Please don't forget to Log Out in the menu when you have done all of your activities.
								</p>
							</h:form>
						</p:panel>
						
						<!-- 
						<br></br>
						<p>#{adminMBean.allGames().size()} Games are in the list</p>
						<br></br>
						<p>There are #{adminMBean.allSuppliers().size()} Suppliers with #{adminMBean.allProducts().size()} supported Products in a Game</p>
						 -->
						<p:panel header="News" toggleable="true">
							<h:form id="form2" styleClass="horizontal_full">
								<h:panelGrid id="newsTicker" columns="2" rowClasses="height50" columnClasses="newsleft,newsright" styleClass="horizontal_full">
								
									<p:dataTable value="#{adminMBean.getAdminNews()}" var="news"
									 		paginator="true" rows="10" >
									 	<p:column headerText= " " width="20">
									 		<h:outputText styleClass="ui-icon ui-icon-mail-closed" />
									 	</p:column>
										<p:column headerText="Date" width="15%">
											<h:outputText value="#{news.newsDate}">
												<f:convertDateTime pattern="dd.MM.yyyy HH:mm" />
											</h:outputText>
										</p:column>
										<p:column headerText="Header" width="10%">
											<h:outputText value="#{news.header}" />
										</p:column>
										<p:column headerText="Game" width="10%">
											<h:outputText value="#{news.gameId}" />
										</p:column>
										<p:column headerText="Message">
											<h:outputText value="#{news.text}" />
										</p:column>
									</p:dataTable>
				
				
									 <p:selectOneMenu id="selectGame" value="#{adminMBean.gameId}" >
						                <f:selectItems value="#{adminMBean.getAllGamesDropDown()}" />
						            </p:selectOneMenu>   
								</h:panelGrid>
				            	
				            	<h:panelGrid id="newsSender" columns="2" columnClasses="newsleft,newsright" styleClass="horizontal_full" >
				            		<p:inputText id="newsText" value="#{adminMBean.newsText}" required="true" styleClass="horizontal_full" maxlength="250"/>
						            <p:commandButton action="#{adminMBean.actionSendMessage()}" id="sendButton" value="Send" update=":adminmain" icon="ui-icon-mail-closed"/>
				            	</h:panelGrid>
			            	</h:form>	
		            	</p:panel>
		            	
		            	
				    
				</p:panel>
		</ui:define>
	</ui:composition>
</h:body>
</html>